import request from './request'

export function getApplication() {
  return request({
    method: 'get',
    url: `audit/getAuditResult`
  })
}
export function releaseCourse(course: any) {
  return request({
    method: 'post',
    url: 'audit/courseApply',
    data: JSON.stringify(course),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
/**id
 * 请假 1
 * 成果奖励 2
 * 社会实践 7
 * 课外活动 8
 * 传入对象在此json化
 */
export function addAudit(id: number, content: any) {
  return request({
    method: 'post',
    url: 'audit/apply',
    params: {
      auditId: id,
      content: JSON.stringify(content)
    }
  })
}
export function getAudit() {
  return request({
    method:'get',
    url:`/audit/getAudit`
  })
}
export function getAllAudit() {
  return request({
    method: 'get',
    url: `/audit/getAllAudit`
  })
}
export function updateAuditStatus(recordId: number, status: number) {
  return request({
    method: 'post',
    url: `/audit/updateAuditStatus`,
    params: {
      recordId: recordId,
      status: status
    }
  })
}
export function deleteAudit(auditId: number)
{
  return request({
    method: 'delete',
    url: `/audit/deleteAudit`,
    params: {
      auditId: auditId
    }
  })
}
export function deleteApply(recordId: number)
{
  return request({
    method: 'delete',
    url: `/audit/deleteApply`,
    params: {
      recordId: recordId
    }
  })
}
export function getStatistics()
{
  return request({
    method: 'get',
    url: `/audit/getStatistics`,
    params: {
      startMonth: "2023.9",
      endMonth: "2024.1"
    }
  })
}
export function getApplyResult(auditId: number) 
{
  return request({
    method: 'get',
    url: `/audit/getApplyResult`,
    params:{
      auditId: auditId
    }
  })
}
